home *** CD-ROM | disk | FTP | other *** search
- \magnification=1000
- \hoffset=0.25 true in\voffset=-0.85 true in
- \vsize=8.0 true in\hsize=7.8 true in % This is for landscape format
- \nopagenumbers\topskip=0pt\parindent=0 pt\offinterlineskip
- \font\medrm=cmr10 at 10.95 pt
- \font\bigrm=cmr10 at 24.88 pt
-
- % This method is based on the facts that the Gregorian year 1752 was
- % a leap year which began on Saturday (it was also the year the
- % British adopted the Gregorian calendar) and that each year of 365 days
- % advances through the cycle of the week by one day.
- \newcount\month \newcount\monthoff \newcount\year \newcount\yearoff
- \newcount\daycount \newcount\monthdays \newcount\date
- \newcount\leap \newcount\numleaps \newcount\lyear
- \newcount\cyear \newcount\qyear
- \newcount\temp \newcount\test \newcount\row \newcount\col
- \def\mod#1#2to#3{\temp=-#1\divide\temp by #2\multiply\temp by #2
- \advance\temp by #1 #3=\temp}
- \def\spellmonth{\ifcase\month
- \or January\or February\or March\or April\or May\or June
- \or July\or August\or September\or October\or November\or December\fi}
- \immediate\write1{}
- \message{Number of month: } \read -1 to \month
- \message{Year: } \read -1 to \year
- \ifnum\year<1753 \message{Can't make calendars for earlier than 1753}\end\fi
- \temp=\year \advance\temp by -1 \yearoff=\temp \advance\yearoff by -1752
- \numleaps=\temp \divide\numleaps by 4
- \test=\temp \divide\test by 100 \advance\numleaps by -\test
- \test=\temp \divide\test by 400 \advance\numleaps by \test
- \advance\numleaps by -424 % That is the number of offset days for 1752.
- \advance\yearoff by \numleaps \mod{\yearoff}{7}to{\date}
- % The day of the week of the first day of the month is similarly determined
- % after first determining whether it is a leap year. \leap is set to 0 if
- % it is not and 1 if it is a leap year.
- \leap=0
- \mod{\year}{4}to{\lyear}
- \mod{\year}{100}to{\cyear}
- \mod{\year}{400}to{\qyear}
- \ifnum\lyear=0 \ifnum\cyear=0 \ifnum\qyear=0 \leap=1\fi
- \else \leap=1\fi\fi
- \monthdays=\ifcase\month 0\or 31\or 28\or 31\or 30\or 31\or 30
- \or 31\or 31\or 30\or 31\or 30\or 31\fi
- \daycount=\ifcase\month 0\or 0\or 31\or 59\or 90\or 120\or 151
- \or 181\or 212\or 243\or 273\or 304\or 334\fi
- \ifnum\month=2 \advance\monthdays by \leap
- \else \ifnum\month>2 \advance\daycount by \leap\fi\fi
- \mod{\daycount}{7}to{\monthoff}
- \test=\date \advance\test by \monthoff \mod{\test}{7}to{\date}
- \date=-\date
-
- \newbox\lodate \setbox\lodate=\vbox to1.1in{\vfil\hrule height1pt width1.1in}
- \newbox\hidate \setbox\hidate=\null \ht\hidate=1.1in \wd\hidate=1.1in
- \newdimen\loht \loht=1.1 in \advance\loht by -1pt
- \def\head#1{\hbox to1.1in{\hfil#1\hfil}}
- \def\doday{\global\advance\date by1
- \ifnum\date<1\copy\lodate
- \else\ifnum\date>\monthdays\copy\hidate
- \else\ifnum\date=1\vrule height1.1in width1pt\fi
- \vbox{\ifnum\row=1\hrule height1pt\fi\hbox to1.1in{\hfil
- \raise60pt\hbox{\number\date}\kern10pt
- \vrule height\loht width1pt}\hrule height1pt}\fi\fi}
-
- \centerline{\bigrm\spellmonth\ \number\year}
- \vskip0.35in
- \line{\medrm\head{Sunday}\head{Monday}\head{Tuesday}\head{Wednesday}
- \head{Thursday}\head{Friday}\head{Saturday}\hss}
- \vskip0.15in
- \row=1
- \loop
- \line{\col=1
- \ifnum\row>1\ifnum\date<\monthdays\vrule height1.1in width1pt\fi\fi
- \loop\doday\advance\col by1\ifnum\col<7\repeat\hss}
- \advance\row by1\ifnum\row<6\repeat
- \bye
-